package com.google.com.coma;

import com.google.code.coma.domain.LifeCycleStep;
import com.google.com.coma.tester.CompletenessTester;
import com.google.com.coma.tester.DefectTester;
import com.google.com.coma.tester.Tester;
import com.google.com.coma.tester.rmi.RmiTesterWorker;
import com.google.com.coma.tester.space.SpaceTesterWorker;

/**
 * @author Bernhard Nickel, e0925384@student.tuwien.ac.at
 */
public class TesterLauncher {
	public static void main(String... args) {
		if (args.length != 3) {
			System.out.println("You have to provide the operation mode: SPACE or RMI");
			return;
		}

		Tester tester = null;
        LifeCycleStep sourceStep = null;

		if (args[2].equals("COMPLETENESS")) {
			tester = new CompletenessTester();
            sourceStep = LifeCycleStep.CREATED;
		} else if (args[2].equals("DEFECT")) {
			tester = new DefectTester();
            sourceStep = LifeCycleStep.TESTED_COMPLETENESS;
		}

		if (args[0].equals("SPACE")) {
			new SpaceTesterWorker(args[1], tester, sourceStep).startWork();
		} else if (args[0].equals("RMI")) {
			new RmiTesterWorker(args[1], tester, sourceStep).startWork();
		} else {
			System.out.println("Unknown operation mode: " + args[0]);
		}
	}
}
